package com.example.personalcenter;

import android.content.Intent;
import android.os.Bundle;
import android.widget.TextView;
import com.example.personalcenter.SharedPrefUtil;

import androidx.appcompat.app.AppCompatActivity;

import java.util.Set;

public class ProfileEditActivity extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_profile_edit);

        // 显示兴趣
        Set<String> interests = SharedPrefUtil.getInterests(this);
        ((TextView) findViewById(R.id.tv_interests)).setText(interests.toString());

        // 退出登录
        findViewById(R.id.btn_logout).setOnClickListener(v -> {
            SharedPrefUtil.clear(this);
            Intent intent = new Intent(this, LoginActivity.class);
            intent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
            startActivity(intent);
            finish();
        });
    }
}